//
//  CostAlgorithm.m
//  RoutingEvaluator
//
//  Created by Christopher Kemsley on 4/12/12.
//  Copyright (c) 2012 iAppolopolis. All rights reserved.
//

#import "CostAlgorithm.hpp"

NamespaceBegin




struct SquaredCostAlgorithm : public CostAlgorithm
{
	SquaredCostAlgorithm (  )
	{ }
	
	virtual Float64	costOfTransmission	( NodeInfo const * node1 , NodeInfo const * node2 ) const
		{
		if ( node1==0 || node2==0 )
			ThrowException ( "BlockCostAlgorithm" , "Attempted to calculate with null nodes" , __FILE__,__LINE__ ) ;
			Float64 d = node1->distanceFromNode(node2) ;
			return d*d ;
		}
	
} ;




CostAlgorithm const&	CostAlgorithm :: distanceSquaredCost ()
	{
	static SquaredCostAlgorithm s ;
	return s ;
	}



NamespaceEnd